﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SSAction : ScriptableObject {
    private bool over;
    private bool enable;
    private int identifier;

    protected SSAction() {}
    public virtual void Update() {
        throw new System.NotImplementedException();
    }

    public void SetOver(bool over) {
        this.over = over;
    }
    public bool IsOver() {
        return over;
    }
    public void SetEnable(bool enable) {
        this.enable = enable;
    }
    public bool IsEnable() {
        return enable;
    }

    /* Should be called by user manually after the instantiation via factory method */
    public void Init(int identifier, ISSActionCallback callback) {
        over = false;
        enable = true;
        this.identifier = identifier;
        this.callback = callback;
    }

    /* Handling callback */
    private ISSActionCallback callback;
    protected void SendActionEvent(SSActionEventType events, Object param) {
        if (callback != null) {
            callback.SSActionEvent(this, events, identifier, param);
        }
    }
    protected void SendCompleteEvent(Object param = null) {
        SendActionEvent(SSActionEventType.COMPLETE, param);
    }
}